<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%
	String contextRoot = request.getContextPath();
%>
<f:loadBundle basename="properties.messages" var="msg"/>
<f:view>
<!doctype html>

<head>
	<%@ include file="include/meta.jsp" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- Mimic Internet Explorer 7 -->
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7,chrome=1">
	
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/template.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">	
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">

<%-- 	<link rel="stylesheet" type="text/css" href="<%= contextRoot %>/css/sisdep-overwrite.css" /> --%>
</head>
<body>
<div id="marco"> <!--inicio contenedor --> 
<div class="arriba-cuerpo"></div> <!-- Para ver borde redondo en IE -->
<div class="cuerpo">
<a href="<%=contextRoot%>/index.jsf"><img src="<%= contextRoot %>/images/logos.png" /></a>
<div class="clear"></div>
<!-- Menu y Usuario init() -->
	<%@ include file="include/menuUsuario.jsp" %>
<!-- Menu y Usuario end() -->
<div class="clear"></div>
<!-- Formulario --> 
<div id="buscador">
<h2>Reportes Centros Comerciales</h2>

<h:form id="CCOReportsForm">
<div class="clear"></div>
	<span class="left">
	<label>Numero de Locales por Centro Comercial</label>
	&nbsp;&nbsp;&nbsp;
		<a4j:commandButton id="ccoNumLocalesReportButton"											 
		                 type="submit" 
		                 value="Generar Reporte" ajaxSingle="true" 
		                 ondblclick="return false;" oncomplete="exportNumLocalesToXLS()"
                         action="#{centroComercialController.generateXlsReportNumLocalesPorCCO}" >					                                                  
		</a4j:commandButton>		
	</span>
	<div class="clear"></div>
	<br/>
	<span class="left">
	<label>Numero de Locales Disponibles por Centro Comercial</label>
	&nbsp;&nbsp;&nbsp;
		<a4j:commandButton id="ccoNumLocalesDispReportButton"											 
		                 type="submit" 
		                 value="Generar Reporte" ajaxSingle="true" 
		                 ondblclick="return false;" oncomplete="exportNumLocalesDispToXLS()"
                         action="#{centroComercialController.generateXlsReportNumLocalesDisponiblesPorCCO}" >					                                                  
		</a4j:commandButton>		
	</span>
	<div class="clear"></div>
	<br/>
	<span class="left">
	<label>Locales Ocupados por Centro Comercial</label>
	&nbsp;&nbsp;&nbsp;
		<a4j:commandButton id="ccoLocalesPersonaReportButton"											 
		                 type="submit" 
		                 value="Generar Reporte" ajaxSingle="true" 
		                 ondblclick="return false;" oncomplete="exportLocalesPersonaToXLS()"
                         action="#{centroComercialController.generateXlsReportLocalesPersonaPorCCO}" >					                                                  
		</a4j:commandButton>		
	</span>	
		<div class="clear"></div>
	<br/>
	<span class="left">
	<label>Locales Disponibles por Centro Comercial</label>
	&nbsp;&nbsp;&nbsp;
		<a4j:commandButton id="ccoLocalesDispReportButton"											 
		                 type="submit" 
		                 value="Generar Reporte" ajaxSingle="true" 
		                 ondblclick="return false;" oncomplete="exportLocalesDispToXLS()"
                         action="#{centroComercialController.generateXlsReportLocalesDisponiblesPorCCO}" >					                                                  
		</a4j:commandButton>		
	</span>
</h:form>
</div>
<!-- Fin formulario -->
<!-- Fin tabla -->
</div>
<div class="abajo-cuerpo"></div> <!-- Para ver borde redondo en IE -->
</div> <!-- Fin contenedor -->
<div class="footer"></div>

	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script><!-- De ser 1ro -->
	<script src="<%=contextRoot%>/js/script.js" type="text/javascript"></script><!-- De ser 2do -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script> <!-- formularios --> 
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
	
	<script src="<%=contextRoot%>/js/sisdep.js"	type="text/javascript"></script>
	
	<script type="text/javascript">
	jQ(document).ready(function() {
		jQ("input, select, input:checkbox, input:radio, input:file").uniform();
		jQ("#CCOReportsForm").validationEngine('attach');
		jQ("#CCOReportsForm").bind("jqv.form.result", function(event, errorFound) {
	        if(!errorFound) displayLoadingImage();
	    });
	});
	
	function exportToPDF() { 
		var reportNameTemp = 'reporteCiante' + document.getElementById('CCOReportsForm:reportType').value + 'PDF';
		showReportPopup('<%= contextRoot %>/reportController.view?format=pdf&reportName=' + reportNameTemp);
    }

	function exportNumLocalesToXLS() { 		
		showReportPopup('<%= contextRoot %>/reportController.view?format=xls&reportName=reporteNumLocalesCCOXLS');
	}

	function exportNumLocalesDispToXLS() { 		
		showReportPopup('<%= contextRoot %>/reportController.view?format=xls&reportName=reporteNumLocalesDispCCOXLS');
	}


	function exportLocalesPersonaToXLS() { 		
		showReportPopup('<%= contextRoot %>/reportController.view?format=xls&reportName=reporteLocalesPersonaCCOXLS');
	}

	function exportLocalesDispToXLS() { 		
		showReportPopup('<%= contextRoot %>/reportController.view?format=xls&reportName=reporteLocalesDispCCOXLS');
	}
	
    
	/**
	 * Funcion JS que permite invocar el servlet de generacion de reportes y presentar una ventana independiente
	 * para su descarga.
	 * 
	 * @author carlos.perez@consult-soft.com
	 * @param servletReporterURL
	 */
	function showReportPopup(servletReporterURL){
	    window.open(servletReporterURL, "reportStandardPopup",
	                "toolbar=0,location=0,scrollbars=1,directories=0,status=0,menubar=0,resizable=1,width="+550+",height="+550+",left="+(screen.width-550)/2+",top="+(screen.height-550)/2);
	}
	</script>
	
	<%@ include file="include/validationStatus.jsp" %>
	<%@ include file="include/modalMessageWindow.jsp" %>
	
</body>
</html>
</f:view>